package com.mavenq.fly.test.quartz;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.Date;

public class HelloJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        // 这里写你要执行的任务逻辑
        System.out.println("Hello Quartz! " + new Date());

        // 可以通过 context 获取 JobDetail 和 Trigger 的信息
        // 例如，获取在安排任务时传入的参数
        JobDataMap dataMap = context.getJobDetail().getJobDataMap();
        String jobParam = dataMap.getString("jobParam");
        System.out.println("传入Job的参数是: " + jobParam);
    }
}